﻿@using Composite.Community.Blog
@inherits RazorFunction
@functions {
    public override string FunctionDescription
    {
        get { return @"Shows the latest five posts from all the blogs on the website."; }
    }

    [FunctionParameter(Label = "Count of items", Help = "The number of latest blog entries to display (5 by default).", DefaultValue = 5)]
    public int Count { get; set; }// TODO: convert default value function markup
}
@{
    var entries = BlogFacade.GetEntries(true).Take(Count);
}

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
    <div class="list-group">
        @foreach (var entry in entries)
        {
            var blogPath = BlogFacade.GetBlogPath(entry.Date, entry.Title);
            <a href="~/page(@entry.PageId)@blogPath" title="@entry.Title" class="list-group-item">
                <h4 class="list-group-item-heading">@entry.Title</h4>
                <small class="text-muted">@entry.Date.ToShortDateString()</small>
                <p class="list-group-item-text">@entry.Teaser</p>
            </a>
        }
    </div>
</body>
</html>

